package com.pctc.controller;


import org.apache.log4j.Logger;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.servlet.ModelAndView;

@ControllerAdvice
public class GlobeExceptionHandlerAdvice {

	private static Logger logger= Logger.getLogger(GlobeExceptionHandlerAdvice.class.getName());


	@ExceptionHandler({RuntimeException.class})
	public ModelAndView handleArithmeticException(Exception ex){
		System.out.println("出异常了全局全局异常: " + ex);
		logger.debug("debug  信息"+ ex);
		logger.info("info  信息"+ ex);
		logger.warn("warn  信息"+ ex);
		logger.error("error  信息"+ ex);
		logger.fatal("fatal  信息"+ ex);
		ModelAndView mv = new ModelAndView("error");
		mv.addObject("exception", ex);
		return mv;
	}



	
}
